package masterjava.common.convertion;

import masterjava.common.io.ReadableFile;
import masterjava.common.shared.Convertible;
import masterjava.common.util.SystemUtil;

import java.io.File;

/**
 * User: gkislin
 * Date: 7/26/11
 */
public class FileConverter implements Convertible<File> {
    private static final FileConverter INSTANCE = new FileConverter();

    private FileConverter() {
    }

    public static FileConverter get() {
        return INSTANCE;
    }

    @Override
    public String toString(File value) {
        return value.toString();
    }

    @Override
    public File toValue(String value) {
        return new ReadableFile(SystemUtil.resolveSystemReplacement(value));
    }
}
